<template>
  <div class="posttable">
    <el-row>
      <el-col :span="24" style="padding-right: 30px;padding-left: 40px;">
        <div class="addform addForm" v-if="form">
          <el-form :label-position="labelPosition" ref="form" :model="form" :rules="rules">
            
            <el-row class="change">
              <el-col :span="5">
                <el-form-item label="姓名" prop="resumePerson.name" style="margin-bottom: 10px;">
                  <el-input placeholder="请输入姓名" v-model.trim="form.resumePerson.name"
                            style="width: 274px"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="人员资质级别" prop="resumePerson.qualificationLevel">
                  <el-input placeholder="请输入人员资质级别" v-model.trim="form.resumePerson.qualificationLevel"
                            style="width: 274px"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="性别" prop="resumePerson.sex">
                  <el-select v-model="form.resumePerson.sex" placeholder="请选择性别" >
                    <el-option label="男" value="男"></el-option>
                    <el-option label="女" value="女"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="民族" prop="resumePerson.nation">
                  <el-select placeholder="请选择民族" v-model.trim="form.resumePerson.nation">
                    <el-option
                      v-for="(item,index) in nations"
                      :key="index"
                      :label="item"
                      :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5">
                <el-form-item label="出生年月" prop="resumePerson.birth">
                  <el-date-picker
                    value-format="yyyy-MM"
                    format="yyyy-MM" 
                    v-model="form.resumePerson.birth"
                    type="month"
                    placeholder="请选择用户生日"
                    style="width:100%;"
                   >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="现居住地" prop="resumePerson.area">
                  <el-input placeholder="请输入现居住地" v-model.trim="form.resumePerson.area"
                            style="width: 274px"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="婚姻状况" prop="resumePerson.marital">
                  <el-select v-model="form.resumePerson.marital" placeholder="请选择婚姻状况">
                    <el-option
                      v-for="(item,index) in options"
                      :key="index"
                      :label="item"
                      :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item prop="resumePerson.mail" :rules="EmailRules2">
                  <el-col><span style="color:#333;"><span style='color:#F56C6C;'>*</span>联系邮箱</span></el-col>
                  <el-input v-model.trim="form.resumePerson.mail" placeholder="请输入联系邮箱" ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5">
                <el-form-item  prop="resumePerson.phone" :rules="PhoneRules">
                  <el-col><span style="color:#333;"><span style='color:#F56C6C;'>*</span>联系方式</span></el-col>
                  <el-input v-model.trim="form.resumePerson.phone" placeholder="请输入联系方式"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="工作年限" prop="resumePerson.workYear">
                  <el-input v-model.trim="form.resumePerson.workYear" placeholder="请输入工作年限"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="开始工作时间" prop="resumePerson.workStart">
                  <el-date-picker
                   value-format="yyyy-MM"
                    format="yyyy-MM" 
                    v-model="form.resumePerson.workStart"
                    type="month"
                    placeholder="请选择开始工作时间"
                    style="width:100%;"
                   >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="从事相关领域时间" prop="resumePerson.workTime">
                  <el-input v-model.trim="form.resumePerson.workTime" placeholder="请输入从事相关领域时间"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5">
                <el-form-item label="到岗时间" prop="resumePerson.arriveTime">
                  <el-input v-model.trim="form.resumePerson.arriveTime" placeholder="请输入到岗时间"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="毕业时间" prop="resumePerson.gurateTime">
                  <el-date-picker
                   value-format="yyyy-MM"
                    format="yyyy-MM" 
                    v-model="form.resumePerson.gurateTime"
                    type="month"
                    placeholder="请选择毕业时间"
                    style="width:100%;"
                   >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col  :span="5" :offset="1">
                <el-form-item label="全日制" prop="resumePerson.fullTime">
                  <el-select v-model="form.resumePerson.fullTime" placeholder="请选择是否全日制">
                    <el-option label="是" value="是"></el-option>
                    <el-option label="否" value="否"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="毕业院校" prop="resumePerson.gurateSchool">
                  <el-input v-model.trim="form.resumePerson.gurateSchool" placeholder="请输入毕业院校"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5">
                <el-form-item label="专业" prop="resumePerson.major">
                  <el-input v-model.trim="form.resumePerson.major" placeholder="请输入专业"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="学历" prop="resumePerson.guration">
                  <el-select v-model="form.resumePerson.guration" placeholder="请选择学历">
                    <el-option
                      v-for="(item,index) in options1"
                      :key="index"
                      :label="item"
                      :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="学位" prop="resumePerson.degree">
                  <el-select v-model="form.resumePerson.degree" placeholder="请选择学位">
                    <el-option
                      v-for="(item,index) in options2"
                      :key="index"
                      :label="item"
                      :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="职业资格证书" prop="resumePerson.certificate">
                  <el-input v-model.trim="form.resumePerson.certificate" placeholder="请输入职业资格证书"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5">
                <el-form-item label="应聘职位" prop="resumePerson.postName">
                  <el-input v-model.trim="form.resumePerson.postName" placeholder="请输入应聘职位"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row type="flex" >
              <el-col :span="11">
                <el-form-item label="职业技能" prop="resumePerson.vocational" style="margin-bottom: 10px;">
                  <el-input type="textarea" placeholder="请输入职业技能" v-model="form.resumePerson.vocational"
                            :autosize="{ minRows: 4}"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="11" :offset="1">
                <el-form-item label="自我评价" prop="resumePerson.evaluation" style="margin-bottom: 10px;">
                  <el-input type="textarea" placeholder="请输入自我评价" v-model="form.resumePerson.evaluation"
                            :autosize="{ minRows: 4}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <div class="line"></div>
              </el-col>
            </el-row>

            <el-row style="margin-top: 0px;" class="oper">
            </el-row>
            <div  class="oper1">
              
              <el-row>
                
                <el-row>
                  <!--学校信息部分-->
                  <el-col>
                    <el-row v-for="(item1,index1) in form.resumeSchools" :key="index1">
                      <el-col :span="5">
                        <el-form-item
                          :prop="'resumeSchools.'+index1+'.schoolName'"
                        >
                          <el-col>
                            <span style="color:#333;">学校名称</span>
                            <!--添加学校-->
                            <i class='el-icon-circle-plus' style="color:#1198ff;font-size: 12px;"
                               v-if="item1.type == 1" @click="addschool(index)"></i>
                            <span style="color:#1198ff;font-size: 14px;" v-if="item1.type == 1"
                                  @click="addschool(index)">添加</span>
                            <!--删除学校-->
                            <i class='el-icon-error' style="color:#f41f1e;font-size: 12px;"
                               v-if="item1.type == 2" @click="deleteschool(index,index1)"></i>
                            <span style="color:#f41f1e;font-size: 14px;" v-if="item1.type == 2"
                                  @click="deleteschool(index,index1)">删除</span>
                          </el-col>
                          <el-col>
                            <el-input placeholder="请输入学校名称" v-model.trim="item1.schoolName"
                                      style="width: 274px"></el-input>
                          </el-col>
                        
                        </el-form-item>
                      
                      </el-col>
                      <el-col :span="5" :offset="1">
                        
                          <el-col>
                            <span style="color:#333;font-size:14px;line-height:40px">时间(毕业时间为“至今”或“xxxx-xx”)</span>
                          </el-col>
                          <el-col :span="10" class="time12" >
                            <el-form-item label=""
                                      :prop="'resumeSchools.'+index1+'.schoolTimea'"
                        >
                            <el-date-picker type="month"  value-format="yyyy-MM"
                    format="yyyy-MM" placeholder="入学时间" v-model="item1.schoolTimea" ></el-date-picker>
                            </el-form-item>
                          </el-col>
                          <el-col :span="1">_</el-col>
                          <el-col :span="11"  class="time12">
                            <el-form-item label=""
                                      :prop="'resumeSchools.'+index1+'.schoolTimeb'"
                                      :rules="checkTime2"
                        >
                            <el-input placeholder="请输入毕业时间" v-model.trim="item1.schoolTimeb"></el-input>
                            </el-form-item>
                          </el-col>
                      </el-col>
                      <el-col :span="5" :offset="1">
                        <el-form-item
                          :prop="'resumeSchools.'+index1+'.schoolMajor'"
                        >
                          <el-col>
                            <span style="color:#333;">专业</span>
                          </el-col>
                          <el-input placeholder="请输入专业" v-model.trim="item1.schoolMajor" style="width: 274px"></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5" :offset="1">
                        <el-form-item
                          :prop="'resumeSchools.'+index1+'.schoolGruation'"
                        >
                          <el-col>
                            <span style="color:#333;">学历</span>
                          </el-col>
                          <el-select v-model="item1.schoolGruation" placeholder="请选择学历">
                            <el-option
                              v-for="(item,index) in options1"
                              :key="index"
                              :label="item"
                              :value="item">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-col>
                </el-row>
                <el-row>
              <el-col>
                <div class="line"></div>
              </el-col>
            </el-row>
                <!-- 项目信息部分 -->
                <el-row>
                  <el-col :span="11"  v-for="(item2,index2) in form.resumeProjects" :key="index2">
                    <el-row >
                      <el-col :span="11">
                        <el-col>
                          <el-form-item
                          :prop="'resumeProjects.'+index2+'.projectName'"
                          :rules="{ 
      required: true, message: '项目名称不能为空', trigger: 'blur'
    }"
                        >
                          <el-col>
                            <span style="color:#333;"><span style='color:#F56C6C;'>*</span> 项目名称</span>
                            <!--添加项目-->
                            <i class='el-icon-circle-plus' style="color:#1198ff;font-size: 12px;"
                               v-if="item2.type == 1" @click="addproject(index)"></i>
                            <span style="color:#1198ff;font-size: 14px;" v-if="item2.type == 1"
                                  @click="addproject(index)">添加</span>
                            <!--删除项目-->
                            <i class='el-icon-error' style="color:#f41f1e;font-size: 12px;"
                               v-if="item2.type == 2" @click="deleteproject(index,index2)"></i>
                            <span style="color:#f41f1e;font-size: 14px;" v-if="item2.type == 2"
                                  @click="deleteproject(index,index2)">删除</span>
                          </el-col>
                          <el-col>
                            <el-input placeholder="请输入项目名称" v-model.trim="item2.projectName"
                                      style="width: 274px"></el-input>
                          </el-col>
                        </el-form-item>
                        </el-col>
                        <el-col>
                          
                          <el-col>
                            <span style="color:#333;font-size:14px;line-height:40px"><span style='color:#F56C6C;'>*</span>项目时间(结束时间为“至今”或“xxxx-xx”)</span>
                          </el-col>
                          <el-col :span="10" class="time12">
                          <el-form-item label=""
                                      :prop="'resumeProjects.'+index2+'.projectTimea'"
                                      :rules="{ required: true, message: '开始时间不能为空', trigger: 'blur'}"
                        >
                            <el-date-picker type="month"  value-format="yyyy-MM"
                    format="yyyy-MM" placeholder="开始时间" v-model="item2.projectTimea" style="width: 100%;"></el-date-picker>
                          </el-form-item>
                          </el-col>
                          <el-col  :span="1">_</el-col>
                          <el-col :span="11" class="time12">
                          <el-form-item label=""
                                      :prop="'resumeProjects.'+index2+'.projectTimeb'"
                                      :rules="checkTime"
                        >
                            <el-input placeholder="请输入结束时间" v-model.trim="item2.projectTimeb"></el-input>
                        </el-form-item>
                         </el-col>
                        </el-col>
                        <el-col>
                          <el-form-item
                          :prop="'resumeProjects.'+index2+'.projectPost'"
                          :rules="{ required: true, message: '请输入担任职位', trigger: 'blur'}"
                        >
                          <el-col>
                            <span style="color:#333;"><span style='color:#F56C6C;'>*</span>担任职位</span>
                          </el-col>
                          <el-input placeholder="请输入担任职位" v-model.trim="item2.projectPost" style="width:100%"></el-input>
                        </el-form-item>
                        </el-col>
                      </el-col>
                      <el-col :span="11" :offset="1">
                        <el-form-item
                          :prop="'resumeProjects.'+index2+'.projectIntroduction'"
                          :rules="{ required: true, message: '项目描述不能为空', trigger: 'blur'}"
                        >
                          <el-col>
                            <span style="color:#333;"><span style='color:#F56C6C;'>*</span>项目描述</span>
                          </el-col>
                          <el-input type="textarea" placeholder="请输入项目描述" v-model="item2.projectIntroduction" :autosize="{ minRows: 10}"  style="width:100%"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-col>
                </el-row>
                <el-row>
              <el-col>
                <div class="line"></div>
              </el-col>
            </el-row>
                <!-- 工作单位信息部分 -->
                <el-row>
                  <el-col :span="11" v-for="(item3,index3) in form.resumeWorks" :key="index3">
                    <el-row >
                      <el-col :span="11">
                        <el-col>
                          <el-form-item
                          :prop="'resumeWorks.'+index3+'.workName'"
                        >
                          <el-col>
                            <span style="color:#333;">工作单位</span>
                            <!--添加工作单位-->
                            <i class='el-icon-circle-plus' style="color:#1198ff;font-size: 12px;"
                               v-if="item3.type == 1" @click="addwork(index)"></i>
                            <span style="color:#1198ff;font-size: 14px;" v-if="item3.type == 1"
                                  @click="addwork(index)">添加</span>
                            <!--删除工作单位-->
                            <i class='el-icon-circle-close' style="color:#f41f1e;font-size: 12px;"
                               v-if="item3.type == 2" @click="deletework(index,index3)"></i>
                            <span style="color:#f41f1e;font-size: 14px;" v-if="item3.type == 2"
                                  @click="deletework(index,index3)">删除</span>
                          </el-col>
                          <el-col>
                            <el-input placeholder="请输入工作单位" v-model.trim="item3.workName"
                                      style="width: 274px"></el-input>
                          </el-col>
                        </el-form-item>
                        </el-col>
                        <el-col>                         
                          <el-col>
                            <span style="color:#333;font-size:14px;line-height:40px">工作时间(结束时间为“至今”或“xxxx-xx”)</span>
                          </el-col>
                          <el-col :span="10" class="time12">
                            <el-form-item label=""
                                      :prop="'resumeWorks.'+index3+'.workTimea'"
                        >
                            <el-date-picker value-format="yyyy-MM"
                    format="yyyy-MM" type="month" placeholder="开始时间" v-model="item3.workTimea" style="width: 100%;"></el-date-picker>
                            </el-form-item>
                          </el-col>
                          <el-col :span="1">_</el-col>
                          <el-col :span="11" class="time12">
                            <el-form-item label=""
                                      :prop="'resumeWorks.'+index3+'.workTimeb'"
                                      :rules="checkTime2"
                        >
                            <el-input placeholder="请输入结束时间" v-model.trim="item3.workTimeb"></el-input>
                            </el-form-item>
                          </el-col>                       
                        </el-col>
                        <el-col>
                          <el-form-item
                          :prop="'resumeWorks.'+index3+'.workPost'"
                        >
                          <el-col>
                            <span style="color:#333;">担任职位</span>
                          </el-col>
                          <el-input placeholder="请输入担任职位" v-model.trim="item3.workPost" style="width:100%"></el-input>
                        </el-form-item>
                        </el-col>
                      </el-col>
                      <el-col :span="11" :offset="1">
                        <el-form-item
                          :prop="'resumeWorks.'+index3+'.workIntroduction'"
                        >
                          <el-col>
                            <span style="color:#333;">工作描述</span>
                          </el-col>
                          <el-input type="textarea" placeholder="请输入工作描述" v-model="item3.workIntroduction" :autosize="{ minRows: 10}"  style="width:100%"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-col>
                </el-row>



              </el-row>
            
            </div>
            <div style="height:50px;width:100%"></div>
            <el-form-item>
              <el-button class="save" :disabled="savedis" @click="submitForm('form')">保存</el-button>
              <el-button class="cancel" @click="cancel('form')">取消</el-button>
            </el-form-item>
          </el-form>
        </div>
      
      </el-col>
    </el-row>
  
  
  </div>
</template>
<script>
  import axios from 'axios'
  import qs from 'qs'
  import moment from "moment";
export default {
    name: "addperson",
    
    data(){
      //校验邮箱的格式
      var checkEmail2 = (rule, value, callback) => {
        
        var re = /^[A-Za-z\d]+(([-_.]*)+[A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
        
        setTimeout(() => {
          if (!value) {
          return callback(new Error('联系邮箱不能为空'));
        }
          if (value) {
            if (!re.test(value)) {
              callback(new Error('请输入正确的邮箱'));
            } else {
              callback();
            }
          } else {
            callback()
          }
        }, 1000);
      };
      //校验时间至今和YYYY-MM
      var checkTime = (rule, value, callback) => {
        
        var re = /^(\d{4})(-)(0?[1-9]|1[0-2])$/;
        
        setTimeout(() => {
          if (!value) {
          return callback(new Error('时间不能为空'));
        }
          if (value) {
            if (value !== "至今"){
              if (!re.test(value)) {
              callback(new Error('请输入YYYY-MM格式,且月份为01-12'));
            } else {
              callback();
            }
            } else {
              callback();
            }
            
          } else {
            callback()
          }
        }, 1000);
      };
      var checkTime2 = (rule, value, callback) => {
        
        var re = /^(\d{4})(-)(0?[1-9]|1[0-2])$/;
        
        setTimeout(() => {
          if (value) {
            if (value !== "至今"){
              if (!re.test(value)) {
              callback(new Error('请输入YYYY-MM格式,且月份为01-12'));
            } else {
              callback();
            }
            } else {
              callback();
            }
            
          } else {
            callback()
          }
        }, 1000);
      };
      //校验座机以及手机号
      var checkphone = (rule, value, callback) => {
        if (!value) {
          return callback(new Error('联系方式不能为空'));
        }
        if (value) {
          var re = /(^0\d{2,4}\-\d{7,8}$)|(^1[3|4|5|6|7|8|9][0-9]{9}$)/;
          
          setTimeout(() => {
            
            if (!re.test(value)) {
              callback(new Error('请输入正确的联系方式'));
              return false;
            } else {
              callback();
            }
            
          }, 1000);
        }
      };
      return {
        checkTime: [
          {validator: checkTime, trigger: 'blur'},
        ],
        checkTime2: [
          {validator: checkTime2,trigger: 'blur'},
        ],
        EmailRules2: [
          {validator: checkEmail2,trigger: 'blur'},
        ],
        PhoneRules: [
          {validator: checkphone,trigger: 'blur'},
        ],
        savedis : false,
        form:{
          resumePerson: {
            name: "",
            qualificationLevel: "",
            sex: "",
            nation: "",
            birth: "",
            area: "",
            marital: "",
            mail: "",
            phone: "",
            workYear: "",
            workStart: "",
            workTime: "",
            arriveTime: "",
            gurateTime: "",
            fullTime: "",
            gurateSchool : '',
            major: "",
            guration: "",
            degree: "",
            certificate: "",
            postName:"",
            vocational: "",
            evaluation: "",
          },
          resumeSchools: [
              {
                schoolName: '',
                schoolTimea: '',
                schoolTimeb: '',
                type: 1,
                schoolMajor: '',
                schoolGruation: ''
              }
            ],
          resumeProjects: [
              {
                projectName: '',
                projectTimea: '',
                projectTimeb: '',
                type: 1,
                projectPost: '',
                projectIntroduction: ''
              }
            ],
          resumeWorks: [
              {
                workName: '',
                workTimea: '',
                workTimeb: '',
                type: 1,
                workPost: '',
                workIntroduction: ''
              }
            ]
            
        },
        rules: {
          resumePerson: {
            name: [
              {required: true, message: '请输入姓名', trigger: 'blur'}
            ],
            sex: [
              {required: true, message: '请选择性别', trigger: 'change'}
            ],
            workYear: [
              {required: true, message: '请输入工作年限', trigger: 'blur'}
            ],
            arriveTime: [
              {required: true, message: '请输入到岗时间', trigger: 'blur'}
            ],
            gurateTime: [
              {required: true, message: '请选择毕业时间', trigger: 'change'}
            ],
            gurateSchool: [
              {required: true, message: '请输入毕业院校', trigger: 'blur'}
            ],
            major: [
              {required: true, message: '请输入专业', trigger: 'blur'}
            ],
            guration: [
              {required: true, message: '请选择学历', trigger: 'change'}
            ],
            introduction: [
              {required: true, message: '请输入客户简介', trigger: 'blur'},
              {max: 200, message: '客户简介长度在200字符内', trigger: 'change'},
              {max: 200, message: '客户简介长度在200字符内', trigger: 'blur'}
            ],
            mendChange: [
              {required: true, message: '请选择需求编号', trigger: 'change'}
            ],
          }
        },
        labelPosition: "top",
        nations : ["汉族","蒙古族","回族","藏族","维吾尔族","苗族","彝族","壮族","布依族","朝鲜族","满族","侗族","瑶族","白族","土家族",  
               "哈尼族","哈萨克族","傣族","黎族","傈僳族","佤族","畲族","高山族","拉祜族","水族","东乡族","纳西族","景颇族","柯尔克孜族",  
               "土族","达斡尔族","仫佬族","羌族","布朗族","撒拉族","毛南族","仡佬族","锡伯族","阿昌族","普米族","塔吉克族","怒族", "乌孜别克族",  
              "俄罗斯族","鄂温克族","德昂族","保安族","裕固族","京族","塔塔尔族","独龙族","鄂伦春族","赫哲族","门巴族","珞巴族","基诺族"],
        options: ['未婚','已婚(有配偶)','丧偶','离婚'],
        options1: ['大专','大学本科','研究生','其他'],
        options2: ['学士','硕士','博士'],
      }
    },
    created(){},
    methods: {
      //      添加学校信息
      addschool(index) {
        this.form.resumeSchools.push({schoolName: '', schoolTimea: '', schoolTimeb: '', schoolMajor: '', schoolGruation: '', type: 2})
      },
//      删除学校信息
      deleteschool(index, index1) {
        this.form.resumeSchools.splice(index1, 1)
      },
      //      添加项目信息
      addproject(index) {
        this.form.resumeProjects.push({projectName: '', projectTimea: '', projectTimeb: '', projectPost: '', projectIntroduction: '', type: 2})
      },
//      删除项目信息
      deleteproject(index, index1) {
        this.form.resumeProjects.splice(index1, 1)
      },
      //      添加工作单位信息
      addwork(index) {
        this.form.resumeWorks.push({workName: '', workTimea: '', workTimeb: '', workPost: '', workIntroduction: '', type: 2})
      },
//      删除工作单位信息
      deletework(index, index1) {
        this.form.resumeWorks.splice(index1, 1)
      },
      //初始化表单数据
      initdata() {
        this.form = {
          resumePerson: {
            name: "",
            qualificationLevel: "",
            sex: "",
            nation: "",
            birth: "",
            area: "",
            marital: "",
            mail: "",
            phone: "",
            workYear: "",
            workStart: "",
            workTime: "",
            arriveTime: "",
            gurateTime: "",
            fullTime: "",
            gurateSchool : '',
            major: "",
            guration: "",
            degree: "",
            certificate: "",
            postName:"",
            vocational: "",
            evaluation: "",
          },
          resumeSchools: [
              {
                schoolName: '',
                schoolTimea: '',
                schoolTimeb: '',
                schoolMajor: '',
                type: 1,
                schoolGruation: ''
              }
            ],
          resumeProjects: [
              {
                projectName: '',
                projectTimea: '',
                projectTimeb: '',
                type: 1,
                projectPost: '',
                projectIntroduction: ''
              }
            ],
          resumeWorks: [
              {
                workName: '',
                workTimea: '',
                workTimeb: '',
                type: 1,
                workPost: '',
                workIntroduction: ''
              }
            ]
            
        };
        this.savedis = false;
      },
      //提交数据
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.savedis = true;
            axios.post(this.url + '/peopleResume/insertPeopleResume',
              this.form
            ).then(res => {
              this.unlogin(res.data.code);
              if (res.data.code == 200) {
                this.savedis = false;
                this.$emit('getData')
              }
            })
          }
        });
      },
      cancel(formName) {
        this.savedis = false;
        this.$refs[formName].resetFields();
        this.$emit('getData1')
      },
      //清除所有的校验信息
      resetFields(formName) {
        this.$refs[formName].resetFields();
      }
    }
}
</script>
<style scoped>
.line {
    border: 0.5px solid #e8e8e8;
    margin-top: 20px;
  }
  
  .oper span {
    font-size: 12px;
  }
  
  .oper i {
    margin-top: 2px;
    line-height: 33px;
  }
  
  .point {
    height: 33px;
    line-height: 33px;
  }
  
  .save {
    width: 150px;
    height: 40px;
    font-size: 16px;
    color: #fff;
    border-radius: 4px;
    margin-right: 43px;
    background: linear-gradient(to bottom, #5696f8 0%, #4e6ef5 100%);
  }
  
  .cancel {
    width: 150px;
    height: 40px;
    border: 1px solid #4e6ef5;
    font-size: 16px;
    font-weight: 500;
    color: #4e6ef5;
  }
  
  .addform {
    color: #333 !important;
  }
  
  .oper i, span {
    cursor: pointer;
    font-weight: 700;
  }
  
  .oper1 i {
    cursor: pointer;
  }
  
  .oper1 span {
    font-weight: 700;
    cursor: pointer;
  }
</style>